
<nav aria-label="breadcrumb" class="pt-4">
  <ol class="breadcrumb">
    <li class="breadcrumb-item">当前的位置：</li>

    <li class="breadcrumb-item"><a href="<?php bloginfo('url'); ?>"><svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" fill="currentColor" class="bi bi-house" viewBox="0 0 16 16">
      <path fill-rule="evenodd" d="M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.708L2 8.207V13.5A1.5 1.5 0 0 0 3.5 15h9a1.5 1.5 0 0 0 1.5-1.5V8.207l.646.647a.5.5 0 0 0 .708-.708L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.707 1.5ZM13 7.207l-5-5-5 5V13.5a.5.5 0 0 0 .5.5h9a.5.5 0 0 0 .5-.5V7.207Z"/>
    </svg>Home:</a></li>

    <?php
    if( is_category() ) { ?>

     <li class="active breadcrumb-item"><?php single_cat_title(); ?></li> 

   <?php }
   elseif ( is_search() ) {  ?> <li class="active breadcrumb-item"><?php echo $s;?></li> <?php  }
   elseif ( is_single() ) {
    $cat = get_the_category();
    $cat = $cat[0];
    $catparent = $cat->parent;
    if($catparent){
      $catparent1 = get_category($catparent);
      echo '<li class="active breadcrumb-item"><a href="'.get_category_link( $catparent1 ).'">'.$catparent1->name.'</a>></li>';}
      echo '<li class="active breadcrumb-item"><a href="'.get_category_link( $cat ).'">'.$cat->name.'</a></li>
      <li class="breadcrumb-item">详细内容</li>';
    }
    elseif ( is_page() ) { ?> <li class="active breadcrumb-item"><?php the_title(); ?></li> <?php  }
    elseif ( is_404() ) {  ?> <li class="active breadcrumb-item">404 错误页面</li> <?php }
      ?>
  </ol>
</nav>

